<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>reflect.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">reflect.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    <span class='nodesc'>No description.</span>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_debug_reflect.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/debug/reflect.js">Git</a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">/goog/debug/reflect.js</div>
    </div>
  </div>
<hr/>


   
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.reflect.className"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.reflect.</span><span class="entryName">className<span class="args">(<span class="arg">classConstructor</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>
      </div>


     <div class="entryOverview">
       Returns the name of a type of object.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">classConstructor</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">A object constructor to get the name of.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>&nbsp;
            The string name of the class.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_reflect.js.source.html#line111">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.reflect.init_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.reflect.</span><span class="entryName">init_<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Adds all known constructors to the type registry.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_reflect.js.source.html#line70">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.reflect.registerType_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.reflect.</span><span class="entryName">registerType_<span class="args">(<span class="arg">name</span>,&nbsp;<span class="arg">ctor</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Registers a type which will be recognized by goog.debug.reflect.typeOf.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">Full name of the type.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">ctor</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The constructor.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_reflect.js.source.html#line60">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.debug.reflect.toString_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.reflect.</span><span class="entryName">toString_<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Copy of <code> Object.prototype.toString</code> to use if it is overridden later.
Although saving the original <code> toString</code> somewhat protects against
third-party libraries which touch <code> Object.prototype</code>, the actual goal
of this assignment is to allow overriding that method, thus more debug
information can be exposed about objects.
See <code> goog.debug.reflect.typeOf</code>.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_reflect.js.source.html#line51">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.debug.reflect.typeOf"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.debug.reflect.</span><span class="entryName">typeOf<span class="args">(<span class="arg">obj</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Guesses the real type of the object, even if its <code> toString</code> method is
overridden. Gives exact result for all goog.provided classes in non-compiled
code, and some often used native classes in compiled code too. Not tested in
multi-frame environment.

Example use case to get better type information in the Watch tab of FireBug:
<pre class="lang-js prettyprint">
Object.prototype.toString = function() {
  return goog.debug.reflect.typeOf(this);
};
</pre>
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">obj</span>
        : <span class="type">*</span>
        <div class="entryOverview">An arbitrary variable to get the type of.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            The namespaced type of the argument or 'Object' if didn't
    manage to determine it. Warning: in IE7 ActiveX (including DOM) objects
    don't expose their type to JavaScript. Their <code> constructor</code>
    property is undefined and they are not even the instances of the
    <code> Object</code> type. This method will recognize them as 'ActiveXObject'.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_debug_reflect.js.source.html#line141">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>






      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory debug</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="" current="/goog/debug/reflect.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
